package dataStructure.xmg1.a04;

import dataStructure.xmg1.a04.list.ArrayList;
import dataStructure.xmg1.a04.list.List;

/**
 * @author: vince_zww
 * @date: 2020/11/27 0:24
 * @desceription: 栈
 */
public class Stack<E> {

    public List<E> list = new ArrayList<>();

    public void clear(){
        list.clear();
    }

    public int size(){
        return list.size();
    }

    public boolean isEmpty() {
        return list.isEmpty();
    }

    public void push(E element) {
        list.add(element);
    }

    public E pop(){
         return list.remove(list.size()-1);
    }

    public E top() {
        return list.get(list.size() - 1);
    }

}
